{% extends "app/base_site.html" %}

{% block title %} {% if  "add" == handle %}添加{% else %}编辑{% endif %}用户 {% endblock title %}

{% block content %}
  <div class="right_col" role="main">
    <div class="">
      <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
          <div class="x_panel">
            <div class="x_title">
              <h2>{% if  "add" == handle %}添加{% else %}编辑{% endif %}用户 <span id="top_msg">{{top_msg}}</span></h2>
              <div class="clearfix"></div>
            </div>
            <div class="x_content">

              <form class="form-horizontal form-label-left" method="post" novalidate>
                <!--
                <p>For alternative validation library <code>parsleyJS</code> check out in the <a href="form.html">form page</a>
                </p>
                <span class="section">Personal Info</span>
                -->

                     <input type="hidden" name="handle"  value="{{ handle }}">
                     <input type="hidden" name="id"  value="{{ user.id }}">

                <div class="item form-group">
                  <label class="control-label col-md-3 col-sm-3 col-xs-12" for="username">用户名 <span class="required" style="color: red;">*</span>
                  </label>
                <div class="col-md-6 col-sm-6 col-xs-12">
                    <input type="text" id="username" class="form-control col-md-7 col-xs-12"  name="username" value="{{user.username}}"  required="required">
                  </div>
                </div>

                <div class="item form-group">
                  <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">邮箱 <span class="required" style="color: red;">*</span>
                  </label>
               <div class="col-md-6 col-sm-6 col-xs-12">
                    <input type="email" id="email" name="email" value="{{user.email}}" required="required" class="form-control col-md-7 col-xs-12">
                  </div>
                </div>
{% if  "add" == handle %}
                <div class="item form-group">
                  <label for="password" class="control-label col-md-3 col-sm-3 col-xs-12">密码 <span class="required" style="color: red;">*</span></label>
   <div class="col-md-6 col-sm-6 col-xs-12">
                    <input id="password" type="password" name="password" class="form-control col-md-7 col-xs-12" required="required">
                  </div>
                </div>
{% else %}
                <div class="item form-group">
                    <label for="new_password" class="control-label col-md-3 col-sm-3 col-xs-12">新密码</label>
                    <div class="col-md-6 col-sm-6 col-xs-12">
                    <input id="new_password" type="password" name="new_password" class="form-control col-md-7 col-xs-12">
                  </div>
                </div>

                <div class="item form-group">
                    <label for="re_password" class="control-label col-md-3 col-sm-3 col-xs-12">确认新密码</label>
                  <div class="col-md-6 col-sm-6 col-xs-12">
                    <input id="re_password" type="password" name="re_password" class="form-control col-md-7 col-xs-12">
                  </div>
                </div>

{% endif %}


                 <div class="form-group">
                      <label class="control-label col-md-3 col-sm-3 col-xs-12">状态 <span class="required" style="color: red;">*</span></label>
                     <div class="col-md-6 col-sm-6 col-xs-12">

                            <div class="radio">
                              <label>
                                <input type="radio" {% if user.is_active == 1 %} checked="checked" {% endif %} value="1" name="is_active"> 正常
                              </label>
                            </div>

                          <div class="radio">
                              <label>
                                <input type="radio" {% if user.is_active == 0 %} checked="checked" {% endif %} value="0" name="is_active"> 禁用
                              </label>
                            </div>

                      </div>
                    </div>

                <div class="form-group">
                  <div class="col-md-6 col-md-offset-3">
                    <button type="button" onclick="history.back()" class="btn btn-primary">取消</button>
                    <button type="submit" class="btn btn-success">提交</button>
                  </div>
                </div>
              </form>

            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
{% endblock content %}

{% block javascripts %}
  {{ block.super }}
  <!-- validator -->
  <script src="/static/vendors/validator/validator.js"></script>
<script>

</script>

{% endblock javascripts %}
